package davidandroidprojecttools.qq986945193.com.davidandroidprojecttools.phone;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;


import davidandroidprojecttools.qq986945193.com.davidandroidprojecttools.R;
import davidandroidprojecttools.qq986945193.com.davidandroidprojecttools.activity.BaseActivity;
import davidandroidprojecttools.qq986945193.com.davidandroidprojecttools.utils.LogUtil;

/**
 * @author ：程序员小冰
 * @新浪微博 ：http://weibo.com/mcxiaobing
 * @GitHub: https://github.com/QQ986945193
 * @CSDN博客: http://blog.csdn.net/qq_21376985
 * @交流Qq ：986945193
 */

/**
 *
 */
public class CallDetailActivity extends BaseActivity {


    private TextView tv_num_bottom;
    private TextView tv_time;
    private TextView tv_num;
    private TextView tv_jietong;
    private ImageView ic_back;

    String time = "";

    @Override
    protected void initView() {
        setContentView(R.layout.activity_call_detail);

        tv_num = (TextView) findViewById(R.id.tv_num);
        tv_time = (TextView) findViewById(R.id.tv_time);
        tv_num_bottom = (TextView) findViewById(R.id.tv_num_bottom);
        tv_jietong = (TextView) findViewById(R.id.tv_jietong);
        ic_back = (ImageView) findViewById(R.id.ic_back);
        if (getIntent() != null) {
            time = getIntent().getStringExtra("time");
            String address = getIntent().getStringExtra("callPhoneAddress");
            String callPhoneNum = getIntent().getStringExtra("callPhoneNum");
            LogUtil.e("time = " + time);
            LogUtil.e("address = " + address);


            if (callPhoneNum.length() < 11 || callPhoneNum.length()>11){
                tv_num_bottom.setText(callPhoneNum);
                tv_num.setText(callPhoneNum);
                tv_time.setText(time);
                tv_jietong.setText("未接通");
            } else {
                StringBuffer sb =new StringBuffer(callPhoneNum);
                sb.insert(3," ");
                sb.insert(8," ");
                String s = sb.toString();
                tv_num_bottom.setText(s);
                tv_num.setText(s);
                tv_time.setText(time);
                tv_jietong.setText("已接通");

            }



        }


    }


    @Override
    protected void initData() {

    }

    @Override
    protected void setOnclickListener() {
        ic_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }


}
